  package cn.zktr.Personnel.model.uitls;

import java.util.List;

import cn.zktr.Personnel.model.pojos.PerPmsFun;
import cn.zktr.Personnel.model.pojos.PerPmsFuns;
import cn.zktr.Personnel.model.pojos.PerPmsPes;
import cn.zktr.Personnel.model.pojos.PerPmsPot;
import cn.zktr.Personnel.model.pojos.PerPmsYG;
import cn.zktr.Personnel.model.pojos.PerPmsYQ;
import cn.zktr.Personnel.model.pojos.PerPmsZG;
import cn.zktr.Personnel.model.pojos.PerPmsZQ;

public class Authority {
	
	//权限id
	private int aid;
	//权限简称
	private String name;
	//权限范围页面
	private String url;
	//权限层级
	private String tai;
	
	//修改权限
	private String sf;
	//id
	private int yid;
	//子权限
	private List<Authority> aut;
	
	public Authority(PerPmsPes ppp,List<Authority> aut) {
		setAid(ppp.getPesid());
		setName(ppp.getPesname());
		setUrl(ppp.getPesurl());
		setTai("tail_1");
		setAut(aut);
	}
	public Authority(PerPmsPes ppp,List<Authority> aut,int i) {
		setAid(ppp.getPesid());
		setName(ppp.getPesname());
		setUrl(ppp.getPesurl());
		setTai("tail_1");
		for(PerPmsYQ ppyq : ppp.getPerPmsYQs()) {
			if(ppyq.getPerPmsEmp().getEmpid()==i) {
				if(ppyq.getYqwht().equals("true")) {
					setYid(ppyq.getYqid());
					setSf("t");
				}else if(ppyq.getYqwht().equals("false")){
					setYid(ppyq.getYqid());
					setSf("f");
				}
			}
		}
		setAut(aut);
	}
	public Authority(PerPmsPes ppp,List<Authority> aut,PerPmsPot ppd) {
		int i = ppd.getPotid();
		setAid(ppp.getPesid());
		setName(ppp.getPesname());
		setUrl(ppp.getPesurl());
		setTai("tail_1");
		for(PerPmsZQ ppzq : ppp.getPerPmsZQs()) {
			if(ppzq.getPerPmsPot().getPotid()==i) {
				if(ppzq.getZqwht().equals("true")) {
					setYid(ppzq.getZqid());
					setSf("t");
				}else if(ppzq.getZqwht().equals("false")){
					setYid(ppzq.getZqid());
					setSf("f");
				}
			}
		}
		setAut(aut);
	}
	public Authority(PerPmsFun ppf,List<Authority> aut) {
		setAid(ppf.getFunid());
		setName(ppf.getFunname());
		setUrl(ppf.getFunurl());
		setTai("tail_2");
		setAut(aut);
	}
	public Authority(PerPmsFun ppf,List<Authority> aut,int i) {
		setAid(ppf.getFunid());
		setName(ppf.getFunname());
		setUrl(ppf.getFunurl());
		setTai("tail_2");
		for(PerPmsYG ppyg : ppf.getPerPmsYGs()) {
			if(ppyg.getPerPmsEmp().getEmpid()==i) {
				if(ppyg.getYgwht().equals("true")) {
					setYid(ppyg.getYgid());
					setSf("t");
				}else if(ppyg.getYgwht().equals("false")){
					setYid(ppyg.getYgid());
					setSf("f");
				}
			}
		}
		setAut(aut);
	}
	public Authority(PerPmsFun ppf,List<Authority> aut,PerPmsPot ppd) {
		int i = ppd.getPotid();
		setAid(ppf.getFunid());
		setName(ppf.getFunname());
		setUrl(ppf.getFunurl());
		setTai("tail_2");
		for(PerPmsZG ppzg : ppf.getPerPmsZGs()) {
			if(ppzg.getPerPmsPot().getPotid()==i) {
				if(ppzg.getZgwht().equals("true")) {
					setYid(ppzg.getZgid());
					setSf("t");
				}else if(ppzg.getZgwht().equals("false")){
					setYid(ppzg.getZgid());
					setSf("f");
				}
			}
		}
		setAut(aut);
	}
	public Authority(PerPmsFuns ppfs) {
		setAid(ppfs.getFunsid());
		setName(ppfs.getFunsname());
		setUrl(ppfs.getFunsurl());
		setTai("tail_3");
	}
	
	public int getYid() {
		return yid;
	}
	public void setYid(int yid) {
		this.yid = yid;
	}
	public int getAid() {
		return aid;
	}
	public void setAid(int aid) {
		this.aid = aid;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTai() {
		return tai;
	}
	public void setTai(String tai) {
		this.tai = tai;
	}
	public List<Authority> getAut() {
		return aut;
	}
	public void setAut(List<Authority> aut) {
		this.aut = aut;
	}
	public String getSf() {
		return sf;
	}
	public void setSf(String sf) {
		this.sf = sf;
	}
	
}
